<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" 
      xmlns:sec="http://www.pollix.at/thymeleaf/shiro">
<head th:replace="admin/common/html/head :: head_Normal(~{::title},~{::link},~{::style})">

<title th:text=${title}></title>
<!-- 这儿引用单独的css link -->
<!-- Ladda for Bootstrap 3按钮加载进度插件 -->
<link rel="stylesheet" th:href="@{/static/admin/assets/js/button/ladda/ladda.min.css}">
<!-- select2样式 -->
<link th:href="@{/static/admin/assets/js/select2/css/select2.min.css}" rel="stylesheet"/>


<style type="text/css">
/**
*这里写单独的css样式
*/

</style>

</head>

<body id="listbody">
<!-- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 代码编写处 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -->

<!-- 右边内容 -->
<div class="wrap-fluid">
    <div class="container-fluid paper-wrap bevel tlbr">
        <!-- 内容 -->
        <!--标题 通用-->
        <div th:replace="admin/common/html/title :: title(${title},${parenttitle},${isMsg},${msgHTML})">
        </div>
        <!-- 结束标题 通用-->
        <div class="content-wrap">
            <!-- 结束内容 -->
            <div class="row">
                <div class="col-sm-12">
                    <!-- 空白页开始-->
                    <div class="nest" id="Blank_PageClose">
                        <div class="title-alt">
                            <h6>表单</h6>
                            <div class="titleClose">
                                <a class="gone" href="#Blank_PageClose">
                                    <span class="entypo-cancel"></span>
                                </a>
                            </div>
                        </div>
                        
                        <div class="body-nest" id="Blank_Page_Content">
                       		<form  class="form-horizontal m" id="form-add">
								<div class="form-group">
	                        		<label class="col-sm-2 control-label ">学院：</label>
									<div class="col-sm-5">
										 <select class="form-control" id="college_select">
											<option th:each="list : ${collegeList}" th:text="${list.collegeName}" th:value="${list.collegeId}">First</option>
										 </select>
									</div>
								</div>
								
								<div class="form-group">
	                        		<label class="col-sm-2 control-label ">专业：</label>
									<div class="col-sm-5">
										 <select class="form-control" id="major_select">
											
										 </select>
									</div>
								</div>
								<div class="form-group">
	                        		<label class="col-sm-2 control-label ">班级：</label>
									<div class="col-sm-5">
										 <select class="form-control" id="clazz_select" >
											
										 </select>
									</div>
								</div>

                                <input type="submit" id="getSearch" class="btn btn-success" value="搜索">
						   </form>
                        	
                        </div>
                    </div>
                </div>
                <!-- 空白页结束 -->
            </div>
            <!-- 结束内容 -->
        </div>
    </div>
</div>
<!-- 结束右边内容 -->
<!-- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 代码编写处 END# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -->

<!-- 通用js -->
<div th:include="admin/common/html/js :: onload_js">
</div>
<!-- 弹窗 -->
<script th:src="@{/static/admin/assets/js/layer/layer.js}" type="text/javascript"></script>
<!-- 遮罩层 -->
<script th:src="@{/static/admin/assets/js/blockUI/jquery.blockUI.js}" type="text/javascript"></script>
<script th:src="@{/static/admin/assets/js/select2/js/select2.full.min.js}" type="text/javascript"></script>
<script type="text/javascript" th:inline="javascript">
//城市查询
function majorList(){
	$("#major_select").html("");
	$.ajax({
		type: 'get',
		dataType: 'json',
	    url: window.rootPath+"/admin/collegeLinked/getMajor?cid="+$("#college_select").val(),
		success:function(data){
		  for (var i = 0; i < data.length; i++) {
			  $("#major_select").append("<option value='"+data[i].majorId+"'>"+data[i].majorName+"</option>");
			  
		  }
		  $("#major_select").select2({
			    placeholder: "请选择"
			}).on("change", function(e) {
				 clazzList();
			})
		  if(data.length<=1){
			  clazzList();
		  }
		 
		}
	})
}

//区县查询
function clazzList(){
	$("#clazz_select").html("");
	$.ajax({
		type: 'get',
		dataType: 'json',
	    url: window.rootPath+"/admin/collegeLinked/getClazz?mid="+$("#major_select").val(),
		success:function(data){
		  for (var i = 0; i < data.length; i++) {
			  $("#clazz_select").append("<option value='"+data[i].clazzId+"'>"+data[i].clazzName+"</option>");
		  }
		  $("#clazz_select").select2({
			    placeholder: "请选择"
			});
		}
	})
}

$(function(){
	$("#college_select").select2({
	    placeholder: "请选择"
	}).on("change", function(e) {
		majorList();
	})
	if($("#college_select option").size()<=1){
		majorList();
	}
})




$("#form-add").submit(function() {
    var string=$("#college_select").val()+','+$("#major_select").val()+','+$("#clazz_select").val();
    $.post(rootPath +"/admin/collegeLinked/search?cid="+$("#college_select").val()+"&&mid="+$("#major_select").val()+"&&clid="+$("#clazz_select").val());
    // $.ajax({
    //     cache : true,
    //     type : "POST",
    //     url : rootPath + "/admin/collegeLinked/search",
    //     data : string
        // error : function(request) {
        //     $.modal.alertError("系统错误");
        // },
        // success : function(data) {
        //     alert(data.valueOf())
        // }
    }


    // alert($("#college_select").val()+$("#major_select").val()+$("#clazz_select").val());
    // alert($(this).val());
    // return false;
   // $.post(rootPath + "/admin/collegeLinked/search?cid="+$("#college_select").val()+"mid="+$("#major_select").val()+"clid="+$("#clazz_select").val())
);
    


</script>

</body>


</html>
